﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.models {
    import flash.events.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.utils.*;

    public class InventoryModel extends Actor {

        private var _inventory:DictStorage;

        public function get inventory():Object{
            return (this._inventory.storage);
        }
        public function set inventory(_arg1:Object):void{
            this._inventory = new DictStorage(_arg1);
            dispatch(new Event(EventConstants.UPDATE_INVENTORY));
        }
        public function getItemNumberByKey(_arg1:String):int{
            return (this._inventory.storage[_arg1]);
        }
        public function getItemKeys():Array{
            return (this._inventory.keys.sort());
        }
        public function decreaseNumberOfItemsByOne(_arg1:String):void{
            this._inventory.set(_arg1, (this.getItemNumberByKey(_arg1) - 1));
            dispatch(new Event(EventConstants.UPDATE_INVENTORY));
        }
        public function increaseNumberOfItemsByOne(_arg1:String):void{
            this._inventory.set(_arg1, (this.getItemNumberByKey(_arg1) + 1));
            dispatch(new Event(EventConstants.UPDATE_INVENTORY));
        }

    }
}//package net.wooga.pets.models 
